package NC22_合并两个有序的数组;

import java.util.*;
public class Solution {
    public void merge(int A[], int m, int B[], int n) {
        int i = 0, j = 0, k = 0;
        int[] c = new int[m + n];
        while (i < m && j < n){
            c[k++] = A[i] < B[j] ? A[i++] : B[j++];
        }

        while (i < m){
            c[k++] = A[i++];
        }
        while (j < n){
            c[k++] = B[j++];
        }

        for (int o = 0; o < k; o++){
            A[o] = c[o];
        }
    }
}